import 'package:flutter/material.dart';
import 'package:hello_flutter/base/index.dart';

class ScrollableIndexWidget extends BasePage {
  const ScrollableIndexWidget({super.key});

  @override
  String getPageTitle() => '可滚动类组件';

  @override
  Widget buildBody(BuildContext context) => SingleChildScrollView(
        padding: const EdgeInsets.all(16),
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/single_child_scroll_View'),
                child: const Text('SingleChildView'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/list_view'),
                child: const Text('ListView'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/scroll_listen_and_control'),
                child: const Text('滚动监听与控制'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/animated_list'),
                child: const Text('AnimatedList'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/grid_view'),
                child: const Text('GridView'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/grid_view_infinite'),
                child: const Text('InfiniteGridView'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/page_view_and_cache', arguments: 'PageView与页面缓存'),
                child: const Text('PageView与页面缓存'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/page_view_and_cache', arguments: '可滚动组件子项缓存'),
                child: const Text('可滚动组件子项缓存'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/tab_bar_view'),
                child: const Text('TabBarView'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/custom_scroll_view_and_slivers'),
                child: const Text('CustomScrollView 和 Slivers'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/custom_sliver'),
                child: const Text('自定义Sliver'),
              ),
              ElevatedButton(
                onPressed: () => Navigator.of(context).pushNamed('/scrollable/nested_scroll_view'),
                child: const Text('嵌套可滚动组件NestedScrollView'),
              ),
            ],
          ),
        ),
      );
}
